/**
 * <copyright>
 * </copyright>
 *

 */
package org.dslintegration.mRules.impl;

import org.dslintegration.mRules.MRulesPackage;
import org.dslintegration.mRules.Source;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Source</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.dslintegration.mRules.impl.SourceImpl#isDominant <em>Dominant</em>}</li>
 *   <li>{@link org.dslintegration.mRules.impl.SourceImpl#isGuard <em>Guard</em>}</li>
 *   <li>{@link org.dslintegration.mRules.impl.SourceImpl#getQualifiedName <em>Qualified Name</em>}</li>
 *   <li>{@link org.dslintegration.mRules.impl.SourceImpl#getName <em>Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SourceImpl extends MinimalEObjectImpl.Container implements Source
{
  /**
   * The default value of the '{@link #isDominant() <em>Dominant</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isDominant()
   * @generated
   * @ordered
   */
  protected static final boolean DOMINANT_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isDominant() <em>Dominant</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isDominant()
   * @generated
   * @ordered
   */
  protected boolean dominant = DOMINANT_EDEFAULT;

  /**
   * The default value of the '{@link #isGuard() <em>Guard</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isGuard()
   * @generated
   * @ordered
   */
  protected static final boolean GUARD_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isGuard() <em>Guard</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isGuard()
   * @generated
   * @ordered
   */
  protected boolean guard = GUARD_EDEFAULT;

  /**
   * The default value of the '{@link #getQualifiedName() <em>Qualified Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getQualifiedName()
   * @generated
   * @ordered
   */
  protected static final String QUALIFIED_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getQualifiedName() <em>Qualified Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getQualifiedName()
   * @generated
   * @ordered
   */
  protected String qualifiedName = QUALIFIED_NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected SourceImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MRulesPackage.Literals.SOURCE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isDominant()
  {
    return dominant;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDominant(boolean newDominant)
  {
    boolean oldDominant = dominant;
    dominant = newDominant;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MRulesPackage.SOURCE__DOMINANT, oldDominant, dominant));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isGuard()
  {
    return guard;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setGuard(boolean newGuard)
  {
    boolean oldGuard = guard;
    guard = newGuard;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MRulesPackage.SOURCE__GUARD, oldGuard, guard));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getQualifiedName()
  {
    return qualifiedName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setQualifiedName(String newQualifiedName)
  {
    String oldQualifiedName = qualifiedName;
    qualifiedName = newQualifiedName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MRulesPackage.SOURCE__QUALIFIED_NAME, oldQualifiedName, qualifiedName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MRulesPackage.SOURCE__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MRulesPackage.SOURCE__DOMINANT:
        return isDominant();
      case MRulesPackage.SOURCE__GUARD:
        return isGuard();
      case MRulesPackage.SOURCE__QUALIFIED_NAME:
        return getQualifiedName();
      case MRulesPackage.SOURCE__NAME:
        return getName();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MRulesPackage.SOURCE__DOMINANT:
        setDominant((Boolean)newValue);
        return;
      case MRulesPackage.SOURCE__GUARD:
        setGuard((Boolean)newValue);
        return;
      case MRulesPackage.SOURCE__QUALIFIED_NAME:
        setQualifiedName((String)newValue);
        return;
      case MRulesPackage.SOURCE__NAME:
        setName((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MRulesPackage.SOURCE__DOMINANT:
        setDominant(DOMINANT_EDEFAULT);
        return;
      case MRulesPackage.SOURCE__GUARD:
        setGuard(GUARD_EDEFAULT);
        return;
      case MRulesPackage.SOURCE__QUALIFIED_NAME:
        setQualifiedName(QUALIFIED_NAME_EDEFAULT);
        return;
      case MRulesPackage.SOURCE__NAME:
        setName(NAME_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MRulesPackage.SOURCE__DOMINANT:
        return dominant != DOMINANT_EDEFAULT;
      case MRulesPackage.SOURCE__GUARD:
        return guard != GUARD_EDEFAULT;
      case MRulesPackage.SOURCE__QUALIFIED_NAME:
        return QUALIFIED_NAME_EDEFAULT == null ? qualifiedName != null : !QUALIFIED_NAME_EDEFAULT.equals(qualifiedName);
      case MRulesPackage.SOURCE__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (dominant: ");
    result.append(dominant);
    result.append(", guard: ");
    result.append(guard);
    result.append(", qualifiedName: ");
    result.append(qualifiedName);
    result.append(", name: ");
    result.append(name);
    result.append(')');
    return result.toString();
  }

} //SourceImpl
